<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="static/css/bootstrap.min.css" rel="stylesheet">
    <script type="text/javascript" src="static/js/jquery-2.2.4.js"></script>

    <script type="text/javascript">
        $(function(){
            $("#btn").click(function(){
                var d = {"pname":$("#pname").val(),
                    pinfo:$("#pinfo").val(),pprice:$("#pprice").val()};
                $.ajax({
                    url:"/product/add",
                    type:"post",
                    data:JSON.stringify(d),
                    dataType:"json",
                    contentType:"application/json",
                    success:function(r){
                       // alert('新增成功');
                        if (r.code===1){
                            location.href="index.html";
                        } else{
                            alert(r.msg);
                        }
                    }
                });
            });
        });
    </script>

</head>
<body>
<h1 style="text-align: center">新增商品</h1>
<form class="form-inline" style="text-align: center" >
    <div class="form-group" style="width: 200px;">
        <label for="pname">商品名称</label>
        <input class="form-control" id="pname" />
    </div><br>
    <div class="form-group" style="width: 200px;">
        <label for="pprice">价格</label>
        <input class="form-control" id="pprice" type="text" />
    </div><br>
    <div class="form-group" style="width: 200px;">
        <label for="pinfo">商品信息</label>
        <input class="form-control" id="pinfo" type="text" />
    </div><br>
    <!--<div class="form-group" style="width: 200px;">-->
        <!--<label for="ptime">商品信息</label>-->
        <!--<input class="form-control" id="ptime" type="text" />-->
    <!--</div>-->
    <button type="button" class="btn-success" id="btn">新增</button>

</form>

</body>
</html>